<layout name='Layout/layout_popup' />
<div class="title panel panel-default">
<div class="panel-body">
	<h3 class="col-md-12">选择部门</h3></div>
</div>
<div class="operate panel panel-default">	<div class="panel-body">
	<div class="pull-left">
		<a  onclick="save();" class="btn btn-default">确定</a>
	</div>
	<div class="pull-right">
		<a  onclick="myclose();" class="btn btn-default">关闭</a>
	</div>
</div></div>
<div class="popup_tree_menu">
	<ul class="tree_menu">
		{$menu}
	</ul>
</div>
<input type="hidden" name="val" id="val">
<input type="hidden" name="name" id="name">
<script type="text/javascript">
	function save() {
		if ($("#name").val().length > 0) {
			$("#dept_name", parent.document).val($("#name").val());
			$("#dept_id", parent.document).val($("#val").val());
		} else {
			alert("请选择部门");
		}
		myclose();
	}


	$(document).ready(function() {
		$(".popup_tree_menu a").click(function() {
			$("#val").val($(this).attr("node"));
			$("#name").val($(this).children("span").text());
			$(".popup_tree_menu .tree_menu  a.active").removeClass("active");
			$(this).addClass("active");
		})
	}); 
</script>